package com.lx.thread.MyThread.lx;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-04-21 14:43:08
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-04-21     张李鑫                     1.0         1.0 Version
 */
public class NodeAdd {

    public volatile static List<Integer> list =new LinkedList<>();


    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 100; i++) {
            int value=i;
          Thread thread=  new Thread(() -> {
                list.add(value);
                System.out.println(value);
            });
          thread.start();
//          thread.join();
        }


        for (int i = 0; i < 100; i++) {
            int value=i;
            Thread thread=  new Thread(() -> {
                list.add(value);
                System.out.println(value);
            });
            thread.start();
//          thread.join();
        }

        for (int i = 0; i < 100; i++) {
            int value=i;
            Thread thread=  new Thread(() -> {
                list.add(value);
                System.out.println(value);
            });
            thread.start();
//          thread.join();
        }
        System.out.println(list.toString());



    }
}
